home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / CIncludes / Aliases.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-29  |  4.9 KB  |  140 lines  |  [TEXT/MPS ]

  1.  
  2. /************************************************************
  3.  
  4. Created: Monday, January 28, 1991 at 12:55 PM
  5.  Aliases.h
  6.  C Interface to the Macintosh Libraries
  7.  
  8.  
  9.   Copyright Apple Computer, Inc. 1989-1991
  10.   All rights reserved
  11.  
  12. ************************************************************/
  13.  
  14.  
  15. #ifndef __ALIASES__
  16. #define __ALIASES__
  17.  
  18. #ifndef __TYPES__
  19. #include <Types.h>
  20. #endif
  21.  
  22. #ifndef __APPLETALK__
  23. #include <AppleTalk.h>
  24. #endif
  25.  
  26. #ifndef __FILES__
  27. #include <Files.h>
  28. #endif
  29.  
  30.  
  31. enum {
  32.  
  33.  
  34. #define rAliasType 'alis'                                            /* Aliases are stored as resources of this type */
  35.  
  36. /* define alias resolution action rules mask */
  37.  
  38.  kARMMountVol = 0x00000001,                                            /* mount the volume automatically */
  39.  kARMNoUI = 0x00000002,                                                /* no user interface allowed during resolution */
  40.  kARMMultVols = 0x00000008,                                            /* search on multiple volumes */
  41.  kARMSearch = 0x00000100,                                            /* search quickly */
  42.  kARMSearchMore = 0x00000200,                                        /* search further */
  43.  kARMSearchRelFirst = 0x00000400,                                    /* search target on a relative path first */
  44.  
  45. /* define alias record information types */
  46.  asiZoneName = -3,                                                    /* get zone name */
  47.  asiServerName = -2,                                                /* get server name */
  48.  asiVolumeName = -1,                                                /* get volume name */
  49.  asiAliasName = 0,                                                    /* get aliased file/folder/volume name */
  50.  asiParentName = 1                                                    /* get parent folder name */
  51.  
  52. };
  53.  
  54. /* define the alias record that will be the blackbox for the caller */
  55. struct AliasRecord {
  56.  OSType userType;                                                    /* appl stored type like creator type */
  57.  unsigned short aliasSize;                                            /* alias record size in bytes, for appl usage */
  58. };
  59.  
  60. typedef struct AliasRecord AliasRecord;
  61. typedef AliasRecord *AliasPtr, **AliasHandle;
  62.  
  63.  
  64. typedef short AliasInfoType;                                        /* alias record information type */
  65. typedef pascal Boolean (*AliasFilterProcPtr) (CInfoPBPtr cpbPtr,    /*I*/
  66. Boolean *quitFlag,                                                    /*O*/
  67. Ptr yourDataPtr);                                                    /*I*/
  68.  
  69. #ifdef __cplusplus
  70. extern "C" {
  71. #endif
  72. /*  create a new alias between fromFile-target and return alias record handle  */
  73. pascal OSErr NewAlias(const FSSpec *fromFile,
  74.                       const FSSpec *target,
  75.                       AliasHandle *alias)
  76.  = {0x7002,0xA823}; 
  77. /* create a minimal new alias for a target and return alias record handle */
  78. pascal OSErr NewAliasMinimal(const FSSpec *target,
  79.                              AliasHandle *alias)
  80.  = {0x7008,0xA823}; 
  81. /* create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  */
  82. pascal OSErr NewAliasMinimalFromFullPath(short fullPathLength,
  83.                                          const unsigned char *fullPath,
  84.                                          ConstStr32Param zoneName,
  85.                                          ConstStr31Param serverName,
  86.                                          AliasHandle *alias)
  87.  = {0x7009,0xA823}; 
  88. #define NewAliasMinimalFromFullpath NewAliasMinimalFromFullPath
  89.  
  90. /* given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. */
  91. pascal OSErr ResolveAlias(const FSSpec *fromFile,
  92.                           AliasHandle alias,
  93.                           FSSpec *target,
  94.                           Boolean *wasChanged)
  95.  = {0x7003,0xA823}; 
  96. /* given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. */
  97. pascal OSErr GetAliasInfo(const AliasHandle alias,
  98.                           AliasInfoType index,
  99.                           Str63 theString)
  100.  = {0x7007,0xA823}; 
  101.  
  102. /* 
  103.   given a file spec, return target file spec if input file spec is an alias.
  104.   It resolves the entire alias chain or one step of the chain.  It returns
  105.   info about whether the target is a folder or file; and whether the input
  106.   file spec was an alias or not. 
  107. */
  108.  
  109. pascal OSErr ResolveAliasFile(FSSpec *theSpec,
  110.                               Boolean resolveAliasChains,
  111.                               Boolean *targetIsFolder,
  112.                               Boolean *wasAliased)
  113.  = {0x700C,0xA823}; 
  114.  
  115. /* 
  116.    Low Level Routines 
  117.  given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag
  118. */
  119.  
  120. pascal OSErr MatchAlias(const FSSpec *fromFile,
  121.                         unsigned long rulesMask,
  122.                         const AliasHandle alias,
  123.                         short *aliasCount,
  124.                         FSSpecArrayPtr aliasList,
  125.                         Boolean *needsUpdate,
  126.                         AliasFilterProcPtr aliasFilter,
  127.                         void *yourDataPtr)
  128.  = {0x7005,0xA823}; 
  129. /* given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. */
  130. pascal OSErr UpdateAlias(const FSSpec *fromFile,
  131.                          const FSSpec *target,
  132.                          AliasHandle alias,
  133.                          Boolean *wasChanged)
  134.  = {0x7006,0xA823}; 
  135. #ifdef __cplusplus
  136. }
  137. #endif
  138.  
  139. #endif
  140.